package com.qf.smartplatform.mapper;

import com.qf.smartplatform.pojo.SysCategory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CategoryMapper {
    @Insert("insert into sys_category (c_id,category_name,create_by) values(#{cId},#{categoryName},#{createBy})")
    void addCategory(SysCategory sysCategory);
    @Select("select * from sys_category where  category_name=#{name}")
    SysCategory findByName(String name);
    @Select("select * from sys_category")
    List<SysCategory> findAllCategories();
    @Delete("delete from sys_category where c_id=#{cId}")
    int deleteCategoryById(Long cId);
    @Insert("update sys_category set  category_name=#{categoryName},tx_command=#{txCommand},rx_command=#{rxCommand},command_name=#{commandName},status=#{status},update_time=#{updateTime},update_by=#{updateBy} where c_id=#{cId}")
    int updateCategory(SysCategory sysCategory);
    @Select("select * from sys_category  where c_id=#{cId}")
    SysCategory findByCid(Long cId);
}
